package com.design.singleton.test;

import com.design.singleton.lazy.StaticInnerClassLazySingleton;

import java.lang.reflect.Constructor;

/**
 * @auther LiZiBa
 * @date 2020/8/8 10:28
 * @description:
 **/
public class ReflectTestLazyStaticInnerClassSingleton {

    public static void main(String[] args) {

        Class<?> clazz = StaticInnerClassLazySingleton.class;

        try{
            Constructor<?> c = clazz.getDeclaredConstructor(null);
            // 反射强制访问私有构造器
            c.setAccessible(true);

            System.out.println(c.newInstance());
            System.out.println(c.newInstance());
        }catch (Exception e){
            e.printStackTrace();
        }


    }
}
